home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / misc / Hunk.lha / Hunk / Rexx / PA.rexx next >
OS/2 REXX Batch file  |  1998-02-14  |  3KB  |  109 lines

  1. /* Patch a user selectable file by Hunk, automatically.
  2.    Run PowerPacker afterwards to crunch it.
  3.    Be warned! Due to a bug in RTPatch, this version DOES NOT
  4.    work with RTPatch installed. If you absolutely MUST use it,
  5.    then remove all "MultiSelect" strings, or quit RTPatch
  6.    manually first.
  7.   
  8.    © 1997 THOR Software.
  9.    PowerPacker is © Nico François        */
  10.  
  11. if ~show(P,'HUNK.1') then; do
  12.     if ~open(.hunklocation,'ENV:Hunk','R') then; do
  13.         address command 'RequestFile Drawer="SYS:" NoIcons Title="Please locate the Hunk" >ENV:Hunk'
  14.         if ~open(.hunklocation,'ENV:Hunk','R') then; exit
  15.         address command 'Copy ENV:Hunk to ENVARC:Hunk'
  16.     end    
  17.     wherehunk=readln(.hunklocation)
  18.     close(.hunklocation)
  19.     if wherehunk='' then; do
  20.         address command 'Delete >NIL: ENV:Hunk ENVARC:Hunk'
  21.         exit
  22.     end
  23.     wherehunk=substr(wherehunk,2,length(wherehunk)-2)
  24.     snip=max(lastpos(':', wherehunk),lastpos('/', wherehunk)) +1
  25.     filename=substr(wherehunk,snip)
  26.     pathname=strip(left(wherehunk, snip-1),'T', '/')
  27.     pragma('D',pathname)
  28.     address command 'run' filename
  29. end
  30. if ~show(P,'POWERPACKER') then; do
  31.     if ~open(.pplocation,'ENV:PowerPacker','R') then; do
  32.         address command 'RequestFile Drawer="SYS:" NoIcons Title="Please locate the PowerPacker" >ENV:PowerPacker'
  33.         if ~open(.pplocation,'ENV:PowerPacker','R') then; exit
  34.         address command 'Copy ENV:PowerPacker to ENVARC:PowerPacker'
  35.     end    
  36.     wherepp=readln(.pplocation)
  37.     close(.pplocation)
  38.     if wherepp='' then; do
  39.         address command 'Delete >NIL: ENV:PowerPacker ENVARC:PowerPacker'
  40.         exit
  41.     end
  42.     wherepp=substr(wherepp,2,length(wherepp)-2)
  43.     snip=max(lastpos(':', wherepp),lastpos('/', wherepp)) +1
  44.     filename=substr(wherepp,snip)
  45.     pathname=strip(left(wherepp, snip-1),'T', '/')
  46.     pragma('D',pathname)
  47.     address command 'run' filename
  48. end
  49. do i=1 while ~show(P,'HUNK.1') & (i<10)
  50.     address command 'Wait 1'
  51. end
  52. do i=1 while ~show(P,'POWERPACKER') & (i<10)
  53.     address command 'Wait 1'
  54. end
  55. if i>9 then; do
  56.     say "Can't lauch the Hunk processor or the PowerPacker."
  57.     say "Delete ENV:Hunk, ENVARC:Hunk, ENV:PowerPacker and "
  58.     say "ENVARC:PowerPacker and try again."
  59.     exit
  60. end
  61. address 'HUNK.1'
  62. WindowToBack
  63. address command 'Requestfile Drawer="RAM:" NoIcons MultiSelect Title="Select the file to process" >t:FileName'
  64. if open(.filename,'T:FileName','R') then; do
  65.     files=readln(.filename)
  66.     Verify off
  67.     do while files~=''
  68.         dbcln=index(files,'"',2)
  69.         filename=substr(files,2,dbcln-2)
  70.         files=substr(files,dbcln+2)
  71.         address 'HUNK.1'
  72.         WindowToFront
  73.         Clear
  74.         Open '"'filename'"'
  75.         ApplyPatch "Libnix.hop"
  76.             ApplyPatch "Libnix.hop"
  77.             ApplyPatch "Lattice.hop"
  78.             ApplyPatch "HCE_NorthC.hop"
  79.             ApplyPatch "AmigaE_32a.hop"
  80.             ApplyPatch "Dice_206.hop"
  81.             ApplyPatch "General020.hop"
  82.             ApplyPatch "AmigaLib.hop"
  83.             ApplyPatch "Ace_235.hop"
  84.             ApplyPatch "Silver_MULU_256.hop"
  85.             ApplyPatch "Silver.hop"
  86.             ApplyPatch "SASC_6xx.hop"
  87.             ApplyPatch "PCQ_12b.hop"
  88.             ApplyPatch "OberonII_30.hop"
  89.             ApplyPatch "Oberon-A_16.hop"
  90.             ApplyPatch "Manx.hop"
  91.         MergeRelocs
  92.         Save '"'filename'.new"'
  93.         Clear
  94.         Address 'POWERPACKER'
  95.         PP2Front
  96.         CommandFile
  97.         DecrNone
  98.         RemoveSymbol on
  99.         RemoveDebug on
  100.         Overwrite on
  101.         Load filename'.new'
  102.         Save filename'.new'
  103.         Say '"'filename' is done. Saved as "'filename'.new"'
  104.     end
  105.     Address 'HUNK.1'
  106.     WindowToBack
  107.     Verify On
  108. end
  109.